﻿IF object_id(N'dbo.TabMailList', 'U') IS NULL
BEGIN
    CREATE TABLE [dbo].[TabMailList] (
        [MailID]          numeric(18,0) NOT NULL identity(1, 1),
        [MailFolderType]  numeric(18,0) NOT NULL,
        [MailReceiverStr] nvarchar(300) COLLATE Chinese_PRC_CI_AS NOT NULL,
        [MailSendDate]    datetime      NOT NULL CONSTRAINT [DF_TabMailList_MailSendDate] default((getdate())),
        [MailSendLevel]   smallint      NOT NULL,
        [MailReceiver]    nvarchar(20)  COLLATE Chinese_PRC_CI_AS NULL,
        [MailSender]      nvarchar(20)  COLLATE Chinese_PRC_CI_AS NULL,
        [MailSubject]     nvarchar(50)  COLLATE Chinese_PRC_CI_AS NULL,
        [MailBody]        nvarchar(max)  COLLATE Chinese_PRC_CI_AS NULL,
        [MailCcToAddr]    nvarchar(300) COLLATE Chinese_PRC_CI_AS NULL,
        [MailBccToAddr]   nvarchar(300) COLLATE Chinese_PRC_CI_AS NULL,
        [MailReadFlag]    bit           NOT NULL CONSTRAINT [DF_TabMailList_MailReadFlag] default(((0))),
        [MailTypeFlag]    bit           NOT NULL,
        [MailSize]        int           NULL,
        [ClassID]         int           NOT NULL CONSTRAINT [DF_TabMailList_ClassID] default(((0))),
        [MailImportance]  int           NOT NULL,

        CONSTRAINT [PK_TabReceiveMail] PRIMARY KEY CLUSTERED ([MailID] asc)
    );
END
GO
